package io.wins.vertx.entity;

import io.vertx.codegen.annotations.DataObject;
import io.vertx.core.json.JsonObject;
import io.wins.vertx.utils.UUIDUtils;
import org.apache.commons.lang3.StringUtils;

@DataObject(generateConverter = true)
public class Role {
    private String id;
    private String roleName;
    private String description;

    private String createdBy;

    private String createdOn;

    private String updatedBy;

    private String updatedOn;

    public Role(final JsonObject json) {
        RoleConverter.fromJson(json, this);
        this.id = StringUtils.isEmpty(json.getString("id")) ?
            UUIDUtils.genId() : json.getString("id");
    }

    public JsonObject toJson() {
        final JsonObject json = new JsonObject();
        RoleConverter.toJson(this, json);
        return json;
    }

    public String getId() {
        return this.id;
    }

    public void setId(final String id) {
        this.id = id;
    }

    public String getRoleName() {
        return this.roleName;
    }

    public void setRoleName(final String roleName) {
        this.roleName = roleName;
    }

    public String getDescription() {
        return this.description;
    }

    public void setDescription(final String description) {
        this.description = description;
    }

    public String getCreatedBy() {
        return this.createdBy;
    }

    public void setCreatedBy(final String createdBy) {
        this.createdBy = createdBy;
    }

    public String getCreatedOn() {
        return this.createdOn;
    }

    public void setCreatedOn(final String createdOn) {
        this.createdOn = createdOn;
    }

    public String getUpdatedBy() {
        return this.updatedBy;
    }

    public void setUpdatedBy(final String updatedBy) {
        this.updatedBy = updatedBy;
    }

    public String getUpdatedOn() {
        return this.updatedOn;
    }

    public void setUpdatedOn(final String updatedOn) {
        this.updatedOn = updatedOn;
    }


}
